home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 424_02 / ED-157 / autoconfigure < prev    next >
Text File  |  1994-03-02  |  2KB  |  52 lines

  1. #! /bin/csh
  2. rm -f test.c test.out compiler config.h
  3. echo "Determining whether you have gcc..."
  4. echo "main(){}" >test.c
  5. gcc -c test.c >&test.out
  6. echo "Creating 'compiler'..."
  7. if ( -z test.out ) then
  8.     set compile=gcc
  9.     echo "CC=gcc" >compiler
  10. #    echo "CFLAGS=-O2 -funroll-loops" >> compiler # does not work with 1.42!
  11.     echo "CFLAGS=-O2" >> compiler
  12. else
  13.     set compile=cc
  14.     echo "CC=cc" >compiler
  15.     echo "CFLAGS=-O" >> compiler
  16. endif
  17. cat compiler
  18. rm -f test.o test.out test.c
  19. echo "Determining whether your compiler understands the 'signed' keyword..."
  20. echo "main(){signed char a;}" >test.c
  21. $compile -c test.c >&test.out
  22. set signed=0
  23. if ( -z test.out ) set signed=1
  24. #ar cq test.a test.o
  25. #ranlib test.a >&test.out
  26. #set ranlib=0
  27. #if ( -z test.out ) set ranlib=1
  28. rm -f test.a test.o test.out test.c
  29. echo "Determining whether your C library includes the 'mmap' and 'munmap' routines..."
  30. echo "extern void mmap();extern void munmap();main(){mmap();munmap();}" >test.c
  31. $compile test.c >&test.out
  32. set mmap=0
  33. if ( -z test.out ) set mmap=1
  34. rm -f test.o test.out test.c
  35. echo "Determining whether your C library includes the 'sbrk' routine..."
  36. echo "extern void sbrk();main(){sbrk();}" >test.c
  37. $compile test.c >&test.out
  38. set sbrk=0
  39. if ( -z test.out ) set sbrk=1
  40. rm -f test.out test.c test.o a.out
  41. #if ( $ranlib ) then
  42. #    echo "rlib=ranlib" >>compiler
  43. #else
  44. #    echo "rlib=echo" >>compiler
  45. #endif
  46. echo "Creating 'config.h'..."
  47. echo "/* This file was created by the 'autoconfigure' procedure.*/" >config.h
  48. if ( ! $signed ) echo "#define NO_SIGNED_CHAR" >>config.h
  49. if ( ! $mmap ) echo "#define NO_MMAP" >> config.h
  50. if ( ! $sbrk ) echo "#define NO_SBRK" >> config.h
  51. cat config.h
  52.